<%@ page import="com.yidu.qx.domain.QxUserEntity" %>
<%@ page import="com.yidu.qx.action.vo.UserVo" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2019/9/29
  Time: 16:31
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
            + path + "/";

    UserVo user = (UserVo)request.getSession().getAttribute("user");
%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>后台管理</title>

    <link rel="stylesheet" type="text/css" href="<%=basePath%>res/css/nav.css">
    <link rel="stylesheet" type="text/css" href="../res/font/iconfont.css">

    <script crossorigin="anonymous" integrity="sha384-vk5WoKIaW/vJyUAd9n/wmopsmNhiy+L2Z+SBxGYnUkunIxVxAv/UtMOhba/xskxh" src="https://lib.baomitu.com/jquery/3.4.1/jquery.min.js"></script>
    <style>
        iframe{
            margin-left: 220px;

            position: absolute;
            left: 0px;
            top: 0px;
        }

    </style>
</head>
<body>
<div class="nav">
    <div class="nav-top">
        <div id="mini" style="border-bottom:1px solid rgba(255,255,255,.1)"><img src="../res/images/mini.png" ></div>
    </div>
    <script>

        $(function () {
            var url ="../CharacterController/index.action";

            //var userObj = JSON.parse('<%=user%>');

            var data ={userId:'<%=user.getUserId()%>',userName:'<%=user.getUserName()%>',userPassword:'<%=user.getUserPassword()%>'};

            //var data = userObj;

            $.post(url,data,function (obj) {
                var one = obj.one;
                var two = obj.two;

                $.each(two,function (i,item) {
                    $("#mainUl").append('<li class="nav-item"><a href="javascript:;"><i class="my-icon nav-icon icon_1"></i><span>'+item.modName+'</span><i class="my-icon nav-more"></i></a><ul id="super'+item.modId+'"></ul></li>');
                });


                $.each(one,function (i,item) {
                    $("#super"+item.tmModId).append('<li><a target="hanhong" href="'+item.modSite+'"><span>'+item.modName+'</span></a></li>');
                });

                // nav收缩展开
                $('.nav-item>a').on('click',function(){
                    if (!$('.nav').hasClass('nav-mini')) {
                        if ($(this).next().css('display') == "none") {
                            //展开未展开
                            $('.nav-item').children('ul').slideUp(300);
                            $(this).next('ul').slideDown(300);
                            $(this).parent('li').addClass('nav-show').siblings('li').removeClass('nav-show');
                        }else{
                            //收缩已展开
                            $(this).next('ul').slideUp(300);
                            $('.nav-item.nav-show').removeClass('nav-show');
                        }
                    }
                });

                //nav-mini切换
                $('#mini').on('click',function(){
                    if (!$('.nav').hasClass('nav-mini')) {
                        $('.nav-item.nav-show').removeClass('nav-show');
                        $('.nav-item').children('ul').removeAttr('style');
                        $('.nav').addClass('nav-mini');
                    }else{
                        $('.nav').removeClass('nav-mini');
                    }
                });

            },"json");
        });
        
    </script>
    <script type="text/javascript" src="../res/js/nav.js"></script>
    <ul id="mainUl">

    </ul>

    <iframe src ="../index.jsp" width="1200" height="650" frameborder="0" name="hanhong">

    </iframe>
</div>
</body>
</html>


